using System;
using System.Collections.Generic;

using Dashboard.Mint.Tiles;
using Dashboard.Mint.Actions;

namespace Dashboard.Latte {

	public class ActionItem : Gtk.Button {

		private Gtk.Label label;
		private Gtk.Image image;
		private Action action;

		private Tile tile;

		public ActionItem (Action action, Tile tile)
		{
			this.action = action;
			this.tile = tile;

			base.Relief = Gtk.ReliefStyle.None;

			Gtk.HBox box = new Gtk.HBox (false, 5);

			image = new Gtk.Image (action.Icon);
			box.PackStart (image, false, false, 0);

			label = new Gtk.Label (action.Name);
			label.Xalign = 0.0f;
			box.PackStart (label, true, true, 0);

			Add (box);
		}

		protected override void OnClicked ()
		{
			action.Execute (tile.Match);
		}

		public new Action Action {
			get { return action; }
		}
	}
}